package cn.com.se.sharepictrue.bean;

import android.graphics.Bitmap;

import com.google.gson.annotations.SerializedName;

import cn.com.se.sharepictrue.utils.StringUtils;

/**
 * Created by Administrator on 2015/12/3.
 */
public class UserInfoBean {
    /**
     * "userID": "1",
     * "userName": "qing",
     * "password": "e10adc3949ba59abbe56e057f20f883e",
     * "token": "e7b219da2dafc7cce5b56f5532eee1025bc29bfb",
     * "userPhone": "13580381716",
     * "userEmail": null,
     * "signature": "叼到不行",
     * "isShow": "1",
     * "isAllow": "1",
     * "portrait": null,
     * "gender": "未选"
     **/

    //用户id
    @SerializedName("userID")
    private String userID;
    //用户昵称
    @SerializedName("userName")
    private String userName;
    //
    @SerializedName("userPhone")
    private String userPhone;
    //
    @SerializedName("userEmail")
    private String userEmail;
    //签名
    @SerializedName("signature")
    private String signature;
    //
    @SerializedName("isShow")
    private String isShow;
    public static final String IS_SHOW = "1";
    public static final String NO_SHOW = "0";
    //
    @SerializedName("isAllow")
    private String isAllow;
    public static final String IS_ALLOW = "1";
    public static final String NO_ALLOW = "0";
    //头像
    @SerializedName("portrait")
    private String portrait;
    //性别
    @SerializedName("gender")
    private String gender;

    @SerializedName("isAdmin")
    private String isAdmin;

    @SerializedName("qq")
    private String qq;

    private Bitmap portraitImage = null;

    public void setUserInfo(UserInfoBean userInfo) {
        setUserID(userInfo.getUserID());
        setGender(userInfo.getGender());
        setIsAllow(userInfo.getIsAllow());
        setIsShow(userInfo.getIsShow());
        setPortrait(userInfo.getPortrait());
        setSighature(userInfo.getSighature());
        setUserEmail(userInfo.getUserEmail());
        setUserName(userInfo.getUserName());
        setUserPhone(userInfo.getUserPhone());
        setPortraitImage(userInfo.getPortraitImage());
        setQq(userInfo.getQq());
        setIsAdmin(userInfo.getIsAdmin());
    }

    public void clearUserInfo() {
        userID = null;
        userName = null;
        userPhone = null;
        userEmail = null;
        signature = null;
        isShow = null;
        isAllow = null;
        portrait = null;
        gender = null;
        portraitImage = null;
        isAdmin = null;
        qq = null;
    }

    public String getQq() {
        return qq;
    }

    public void setQq(String qq) {
        this.qq = qq;
    }

    public String getUserID() {
        return userID;
    }

    public void setUserID(String userID) {
        this.userID = userID;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getUserPhone() {
        return userPhone;
    }

    public void setUserPhone(String userPhone) {
        this.userPhone = userPhone;
    }

    public String getUserEmail() {
        return userEmail;
    }

    public void setUserEmail(String userEmail) {
        this.userEmail = userEmail;
    }

    public String getSighature() {
        return signature;
    }

    public void setSighature(String sighature) {
        this.signature = sighature;
    }

    public String getIsShow() {
        return isShow;
    }

    public void setIsShow(String isShow) {
        this.isShow = isShow;
    }

    public String getIsAllow() {
        return isAllow;
    }

    public void setIsAllow(String isAllow) {
        this.isAllow = isAllow;
    }

    public String getPortrait() {
        return portrait;
    }

    public void setPortrait(String portrait) {
        this.portrait = portrait;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public Bitmap getPortraitImage() {
        return portraitImage;
    }

    public void setPortraitImage(Bitmap portraitImage) {
        this.portraitImage = portraitImage;
    }

    public String getIsAdmin() {
        return isAdmin;
    }

    public void setIsAdmin(String isAdmin) {
        this.isAdmin = isAdmin;
    }

    public boolean isHaveData() {
        if (!StringUtils.isEmpty(userPhone) && userPhone.length() > 0)
            return true;
        else return false;
    }

    public boolean isAdmin() {

        if (StringUtils.isEmpty(isAdmin))
            return false;
        if (isAdmin.contentEquals("1"))
            return true;
        else
            return false;
    }

    @Override
    public String toString() {
        return "UserInfoBean{" +
                "userID='" + userID + '\'' +
                ", userName='" + userName + '\'' +
                ", userPhone='" + userPhone + '\'' +
                ", userEmail='" + userEmail + '\'' +
                ", signature='" + signature + '\'' +
                ", isShow='" + isShow + '\'' +
                ", isAllow='" + isAllow + '\'' +
                ", portrait='" + portrait + '\'' +
                ", gender='" + gender + '\'' +
                ", isAdmin='" + isAdmin + '\'' +
                ", qq='" + qq + '\'' +
                ", portraitImage=" + portraitImage +
                '}';
    }
}
